import { defineStore } from 'pinia'
import { fetchSeqNo } from '@/api/account'

export const useAccountStore = defineStore('account', {
  state: () => ({
    SEQ_NO: ''
  }),
  getters: {
    seqNo: (state) => state.SEQ_NO
  },
  actions: {
    getSeqNo() {
      return new Promise((resolve, reject) => {
        fetchSeqNo()
          .then((res) => {
            const SEQ_NO = `${res.data}`
            this.SEQ_NO = SEQ_NO
            resolve(SEQ_NO)
          })
          .catch((error) => {
            reject(error)
          })
      })
    }
  }
})
